package com.qipay.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by Administrator on 2016/8/13.
 */
public class DataValidUtils {
    private DataValidUtils(){}

    /*
    * 手机号是否合法
    * */
    public static boolean isMobileValid(String mobile){
        Pattern pattern = Pattern.compile("^0?(13|15|17|18)[0-9]{9}$");
        Matcher matcher = pattern.matcher(mobile);
        return matcher.matches();
    }

    /*
    * email的是否合法
    * */
    public static boolean isEmailValid(String email){
        Pattern pattern = Pattern.compile("\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*");
        Matcher matcher = pattern.matcher(email);
        return matcher.matches();
    }
}
